package 剑指offer;

public class _63股票的最大利润 {
    public int maxProfit(int[] prices) {
        int min = Integer.MAX_VALUE,res = 0;
        for(int i = 0; i < prices.length; i++){
            min = Math.min(min,prices[i]);
            res = Math.max(res,prices[i] - min);
        }
        return res;
    }
}
